package com.engine.salary.entity.datacollection.param;

import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryI18nUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.Collection;
import java.util.List;

/**
 * 数据采集-考勤引用数据同步参数
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuoteDataSyncParam {

    //薪资所属月
    private String salaryYearMonth;

    //关联账套id
    private List<Long> salarySobIds;

    //账套外人员主键id
    private Collection<Long> employeeIds;

    //备注
    private String description;

    public static void  checkParam(AttendQuoteDataSyncParam saveParam) {
        if (saveParam == null){
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100294, "参数异常"));
        }
        if (StringUtils.isEmpty(saveParam.getSalaryYearMonth())) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100294, "薪资所属月必传"));
        }
        if (CollectionUtils.isEmpty(saveParam.getSalarySobIds())) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100295, "薪资账套必传"));
        }
    }
}
